package cn.tedu.eguser.basic.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private Integer code;
    private String message;
    private String data;

    public JsonResult(StatusCode statusCode){
        this.code =statusCode.getCode();
        this.message =statusCode.getMessage();
    }
    public JsonResult(StatusCode statusCode , String data){
        this.code =statusCode.getCode();
        this.message =statusCode.getMessage();
        this.data  =data;
    }

    public static JsonResult ok(){
        return new JsonResult(StatusCode.OPERATION_SUCCESS);
    }
    public static JsonResult ok(String data){
        return new JsonResult(StatusCode.OPERATION_SUCCESS, data);
    }



}
